<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="Js/autocomplete/jquery.autocomplete.css" />
		<script src="libs/jquery-1.9.0.js" type="text/javascript" charset="utf-8"></script>
		<script src="Js/autocomplete/jquery.autocomplete.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var KJKM_DATA = [{
				name: "a123",
				value: 1
			}, {
				name: "b123",
				value: 2
			}, {
				name: "a456",
				value: 3
			}, {
				name: "b456",
				value: 4
			}];
			//设置科目AutoCompleteItem
			function setAutocompleteItem(el) {
				$(el).autocomplete(KJKM_DATA, {
					width: 320,
					max: 10000,
					highlight: false,
					multiple: false,
					matchContains: "word",
					minChars: 0,
					formatItem: function(row, i, max) {
						return row.name;
					},
					formatMatch: function(row, i, max) {
						return row.name + "_match";
					},
					formatResult: function(row, i, max) {
						return row.name + "_result";
					}
				}).result(function(event, data, formatted) {
					alert(data.name + "," + data.value);
				});
			}
			$(function() {
				setAutocompleteItem("#myText");
			})
		</script>

	</head>

	<body>
		<input type="text" id="myText" value="" />
	</body>

</html>